<template>
  <a-modal destroyOnClose :title="$t('candidateApplication.normal_resume')" :maskClosable="false" :visible="visible" :width="920" @cancel="cancelModal(false)" @ok="handleOk" class="ResumeEdit">
    <position-rec-desc :nodesc="true">
      <resume-update :positionInfo="positionInfo" ref="resumeUpdate" slot="content" :isEdit="!isEdit" :formData="resumeData" :enterpriseId="enterpriseId" :positionId="positionId" :id="id" :resumeId="resumeId"/>
    </position-rec-desc>
    <!-- <div class="ant-modal-footer">
      <a-button key="back" @click="cancelModal(false)">
          取消
      </a-button>
      <a-button key="submit" type="primary" :loading="loading" @click="cancelModal(true)">
        保存
      </a-button>
    </div> -->
  </a-modal>
</template>

<script>
// import { mapState } from 'vuex'
// import { fileSave, saveResume, recommend, resumeCheck } from '@/api/resume'
import PositionRecDesc from '@/components/position/PositionRecDesc'
import ResumeUpdate from '@/components/resume/ResumeUpdate'
// import PositionRecReason from '@/components/position/PositionRecReason'
export default {
  name: 'ResumeEdit',
  props: ['visible', 'positionId', 'enterpriseId', 'resumeData', 'sendData', 'resumeId', 'id', 'positionInfo', 'isEdit'],
  components: { ResumeUpdate, PositionRecDesc },
  data () {
    return {
    }
  },
  computed: {
  },
  methods: {
    async handleOk () {
      let data = await this.$refs.resumeUpdate.sendData() // 获取编辑页面的整理好的数据
      if (data && data.resumeId) {
        this.cancelModal(true)
      } else {
        this.$message.error(`${this.$t('common.confirm_require')}！`)
      }
    },
    cancelModal (flag) {
      this.$emit('close', flag)
    }
  }
}
</script>

<style lang="stylus" scoped>
@import '../../styles/var.styl'
</style>
<style lang="stylus">
.ResumeEdit
  :global(.ant-modal-content .ant-modal-body)
    padding 24px 0 0
  :global(.ant-modal-footer)
    padding 16px 24px
</style>
